﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Xml.Serialization;

namespace Perceiveit.Xml.Tests.Serialized
{
    public class LocalString
    {
        private string _local, _invariant;
        private CultureInfo _culture;

        [XmlText()]
        public string Local
        {
            get { return _local; }
            set { _local = value; }
        }

        [XmlAttribute("invariant")]
        public string Invariant
        {
            get { return _invariant; }
            set { _invariant = value; }
        }


        [XmlAttribute("culture")]
        public string xCulture
        {
            get { return _culture == null ? string.Empty : _culture.Name; }
            set { _culture = string.IsNullOrEmpty(value) ? null : CultureInfo.GetCultureInfo(value); }
        }

        [XmlIgnore()]
        public CultureInfo Culture
        {
            get { return _culture; }
            set { _culture = value; }
        }
    }
}
